<template>
  <div
    :style="{
      paddingBottom: tempData.paddingBottom + 'px',
      paddingLeft: tempData.paddingTwice + 'px',
      paddingRight: tempData.paddingTwice + 'px',
      paddingTop: tempData.paddingTop + 'px',
      boxSizing: 'border-box',
    }"
  >
    <div
      :style="
        tempData.showType == 1
          ? {
              borderTopLeftRadius: tempData.radiusNumTop + 'px',
              borderTopRightRadius: tempData.radiusNumTop + 'px',
              borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
              borderBottomRightRadius: tempData.radiusNumBottom + 'px',
              backgroundColor: tempData.boxBg,
            }
          : {
              borderTopLeftRadius: tempData.radiusNumTop + 'px',
              borderTopRightRadius: tempData.radiusNumTop + 'px',
              borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
              borderBottomRightRadius: tempData.radiusNumBottom + 'px',
              backgroundImage: 'url(' + tempData.bgImage + ')',
              backgroundSize: '100% 100%',
            }
      "
    >
      <view class="topContent">
        <img :src="tempData.wifiImg" class="leftlogo" v-if="tempData.showStyle == 1" mode="" />
        <img
          src="@/assets/didaima/logo2.png"
          style="width: 75px; height: 75px; margin-right: 23px"
          v-else
          mode=""
        />
        <view class="texts">
          <text
            class="names"
            :style="{
              marginBottom: '10px',
              color: tempData.textColor,
            }"
            >WIFI名称：名称</text
          >
          <text
            class="names"
            :style="{
              color: tempData.textColor,
            }"
            >WIFI密码：密码</text
          >
        </view>
        <view
          class="xiugais"
          :style="{
            color: tempData.caozuoColor,
          }"
        >
          修改WIFI
        </view>
      </view>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { ref, watch } from 'vue'

  const props = defineProps({
    // 选中的当前组件参数
    compObj: {
      type: Object,
      default: () => {
        return {}
      },
    },
  })
  console.log(props)
  const tempData: any = ref({})
  watch(
    () => props.compObj,
    (newVal, oldVal) => {
      tempData.value = JSON.parse(JSON.stringify(newVal))
    },
    { immediate: true, deep: true }
  )
</script>

<style scoped lang="less">
  .topContent {
    width: 100%;
    padding: 20px 15px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    background-size: 100% 100%;
    position: relative;

    .leftlogo {
      width: 80px;
      height: 65px;
      margin-right: 20px;
    }

    .xiugais {
      color: #3491fa;
      font-size: 13px;
      position: absolute;
      right: 8px;
      top: 4px;
    }

    .texts {
      display: flex;
      flex-wrap: wrap;

      .names {
        width: 100%;
        font-size: 15px;
        line-height: 15px;
        color: #1d1929;
        font-weight: bold;
      }
    }
  }
</style>
